package com.company.wushuo.justfortest;

import android.util.Log;

import com.company.wushuo.justfortest.reactive.Observable;
import com.company.wushuo.justfortest.reactive.OnSubscribe;
import com.company.wushuo.justfortest.reactive.Subscriber;

/**
 * Created by wushuo on 2021/4/6
 */
public class MyRxJavaTest {

    static void test() {
        Observable.create(new OnSubscribe<Integer>() {
            @Override
            public void call(Subscriber<Integer> subscriber) {
                subscriber.onNext(10);
                subscriber.onNext(9);
                subscriber.onComplete();
            }
        }).subscribe(new Subscriber<Integer>() {
            @Override
            public void onComplete() {
                Log.d("wushuo", "received onComplete");
            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(Integer integer) {
                Log.d("wushuo", "received " + integer);
            }
        });
    }
}
